package com.xtu.hrms.controller;

/**
 * @author : FeiYu Hao
 * @date : 2023/4/29 18:36
 * @modyified By :
 */

import com.xtu.hrms.bean.Emp;
import com.xtu.hrms.dao.EmployeeDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;

/**
 * @author : FeiYu Hao
 * @date : 2023/4/17 15:25
 * @modyified By :
 */
@Controller
public class EmpController1 {
    @Autowired
    EmployeeDao employeeDao;

    @GetMapping("/emps1")
    public String list(Model model) {
        Collection<Emp> employees = employeeDao.getAllEmp();
//        将数据存放到model,返回给前端
        model.addAttribute("emp", employees);
        return "emp/list1";
    }

}

